import 'dart:convert';

import 'package:flutter_deer/generated/json/base/json_field.dart';
import 'package:flutter_deer/generated/json/create_order_entity.g.dart';

@JsonSerializable()
class Discount {
  String discountAmount = ""; // 优惠金额
  String discountDesc = ""; // 优惠说明
  String discountTypeName = "优惠券"; // 优惠说明
  String discountType = ""; // 优惠类型 会员等级优惠 -- coupon
  String exclusiveStatus = ""; // 活动互斥状态 PromotionsExclusiveStatusEnum
  String promotionsDetailId = ""; // [老王返回] 活动明细id
  String promotionsId = ""; // [老王返回] 活动id
  String memberCouponId = ""; // [浩宇需要] 会员优惠券ID 选择的优惠券id
  String discountBizId = ""; // [浩宇需要] 优惠业务ID 需要用 promotionsId 填充赋值
  int customDataType = 0; // 0自然 1文本
  List<GoodsDetail> goodsDetails = []; // 商品详情
  String useIntegral = ""; // 抵现积分数

	Discount() {}

	factory Discount.fromJson(Map<String, dynamic> json) => $DiscountFromJson(json);
	Map<String, dynamic> toJson() => $DiscountToJson(this);
}

@JsonSerializable()
class GoodsDetail {
  String discountAmount = "";
  String goodsId = "";
  String discountQuantity = "";
  String salesChannelGoodsId = "";
  String useIntegral = "";

  GoodsDetail();
	factory GoodsDetail.fromJson(Map<String, dynamic> json) => $GoodsDetailFromJson(json);
	Map<String, dynamic> toJson() => $GoodsDetailToJson(this);
}

@JsonSerializable()
class EnergyGoods {
  String goodsAmount = ""; // 金额
  String mchGoodsId = ""; // 商户商品id
  String price = "";
  String quantity = ""; // 数量
  String shelfId = "";
  String shelfNo = ""; // 货架号(加注枪号)

  EnergyGoods() {}
	factory EnergyGoods.fromJson(Map<String, dynamic> json) => $EnergyGoodsFromJson(json);
	Map<String, dynamic> toJson() => $EnergyGoodsToJson(this);
}

@JsonSerializable()
class CreateOrderOfflineDiscounts {
  String? offlineDiscountsAmount = ""; // 线下优惠最终金额,
  int? promotionsMode = 0; // 1：直减、 2：折扣,
  String? orderPromotionsActivityId = ""; // 预设id,
  String? strength = ""; // 优惠力度,

  CreateOrderOfflineDiscounts();

  factory CreateOrderOfflineDiscounts.fromJson(Map<String, dynamic> json) => $CreateOrderOfflineDiscountsFromJson(json);

  Map<String, dynamic> toJson() => $CreateOrderOfflineDiscountsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class PayInfo {
  String? accountType = '';
  String? authCode = '';
  String? consumeIntegral = '';
  String? memberAccountId = '';
  String? orderFinanceId = '';
  String? password = '';
  String? payAmount = '';
  String? payMethod = '';
  String? payOrderId = '';
  String? payType = '';
  List<PayDouYCoupon>? thirdDouYCouponRequests = [];

  PayInfo();

	factory PayInfo.fromJson(Map<String, dynamic> json) => $PayInfoFromJson(json);
	Map<String, dynamic> toJson() => $PayInfoToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class PayDouYCoupon {
  String? beginTime = '';
  String? certificateId = '';
  String? encryptedCode = '';
  String? endTime = '';
  int? listMarketAmount = 0;
  int? originalAmount = 0;
  String? skuId = '';
  String? storeId = '';
  String? tikTokeOrderId = '';
  String? title = '';
  String? verifyToken = '';

  PayDouYCoupon();

	factory PayDouYCoupon.fromJson(Map<String, dynamic> json) => $PayDouYCouponFromJson(json);
	Map<String, dynamic> toJson() => $PayDouYCouponToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class StoreGoodsInfos {
  String price = "";
  int quantity = 0;
  String mchGoodsId = "";
  String goodsAmount = "";
  String salesChannelGoodsId = "";

  StoreGoodsInfos();

	factory StoreGoodsInfos.fromJson(Map<String, dynamic> json) => $StoreGoodsInfosFromJson(json);
	Map<String, dynamic> toJson() => $StoreGoodsInfosToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
